<?php

class MovieListView extends View {

	protected $movieList;

	function __construct() {
	
	}
	
	function display() {
		echo '<div style="width:90%">';
		echo '<table class="table table-striped">';
		echo '<thead><th>id</th><th>Title</th><th>Year of release</th><th>Director</th><th>Rating</th><th>Copies Available</th><th>Price</th></thead>';
		foreach ($this->movieList as $movie) {
			echo '<tr><td>'.$movie->getId().'</td>
					<td><a href="?page=store_manager&view=editMovie&movieId='
														.$movie->getId().'&movieName='.$movie->getTitle().'&noCopies='
														.$movie->getNoCopies().'">'.$movie->getTitle().'</a></td>
					<td>'.$movie->getYear().'</td>
					<td>'.$movie->getDirectorFirstName().' '.$movie->getDirectorLastName().'</td>
					<td>'.$movie->getRating().'</td>
					<td>'.$movie->getNoCopies().'</td>
					<td>'.$movie->getPrice().'</td>
					</tr>';
		}
		echo '</table>';
		echo '</div>';
	}
	
	function getMovieList() {
		return $this->movieList;
	}
	
	function setMovieList($m) {
		$this->movieList = $m;
	}
}

?>